﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Se7en.Admin.Common;
using Se7en.Admin.Model;

namespace Se7en.Admin.Web
{
    public partial class Login : AdminPageBase
    {
        protected override bool NeedAuthenticate
        {
            get
            {
                return false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (this.Login(txtUsername.Text,txtPassword.Text, true ))
            {
                string returnUrl = Request.QueryString["ReturnUrl"];
                if (!string.IsNullOrWhiteSpace(returnUrl))
                    Response.Redirect(Server.UrlDecode(returnUrl));
                else
                    Response.Redirect(PageConstants.AdminUrl.Root + PageConstants.AdminUrl.Home);
            }
            else
                lblInfo.Text = "Username or password is not correct";
        }

        private void DisableMenu()
        {
            this.Master.Page.FindControl("panelMenu");
        }
    }
}